# coding:utf-8
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
from collections import OrderedDict


class Page(PageNumberPagination):
    page_size = 10
    page_size_query_param = 'limit'
    max_page_size = 90

    def get_paginated_response(self, data):
        return Response(OrderedDict([
            ('count', self.page.paginator.count),
            ('next', self.get_next_link()),
            ('previous', self.get_previous_link()),
            ('code', '0001'),
            ('msg', 'success'),
            ('obj', data)
        ]))
